package br.com.sisat.util;

import java.math.BigDecimal;
import java.text.NumberFormat;

public class BigDecimalUtil {

	public static String converterEmValorMonetarioBrasileiroComSimboloMonetario(BigDecimal valor) {
		return valor == null ? null : NumberFormat.getCurrencyInstance().format(valor);
	}
	
	public static String converterEmValorMonetarioBrasileiro(BigDecimal valor) {
		return valor == null ? null : NumberFormat.getCurrencyInstance().format(valor).replace("R$ ", "");
	}
	
	public static String converterEmValorMonetarioBrasileiroSimples(BigDecimal valor) {
		return valor == null ? null : NumberFormat.getCurrencyInstance().format(valor).replace("R$ ", "").replaceAll("\\$", "").replaceAll("\\.", ",");
	}

	public static BigDecimal converterValorMonetarioBrasileiroEmBigDecimal(String valor) {
		return valor == null ? null : new BigDecimal(valor.replace("R$ ", "").replaceAll("\\.", "").replace(",", "."));
	}

}
